/*
 * Copyright (C) 2010, Funcom AS, All Rights Reserved
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  @authors
 *  Svein Gunnar Larsen <sveingunnarlarsen@gmail.com>
 *  Erik Thune Lund <culex.eriklund@gmail.com>
 *  Michel Krohn-Dale <kronicz@gmail.com>
 */

package com.funcom.peeler.list;

import com.funcom.peeler.peelable.PeelComponent;

import javax.swing.tree.DefaultMutableTreeNode;

public class ListNode extends DefaultMutableTreeNode {

    PeelComponent component;
    Boolean hide = new Boolean( false );
    Boolean lock = new Boolean( false );
    String name = null;

    public ListNode() {
        component = null;
    }

    public ListNode(PeelComponent component) {
        this.component = component;
    }

    public ListNode(String name) {
        this.name = name;
    }

    public void setComponent(PeelComponent component) {
        this.component = component;
    }

    public void setHide(Boolean val) {
        hide = val;
    }
    public void setLock(Boolean val) {
        lock = val;
    }

    public PeelComponent getComponent() { return component; }

    public Boolean getHide() { return hide; }

    public Boolean getLock() { return lock; }

    String getElement() {
        if (component == null) {
            return "no component";
        } else {
            return component.getClass().getSimpleName();
        }
    }

    String getName()  {
        if (component == null) {
            return "no component";
        } else if (component.getComponent().getName().equals("canvas_window")) {
            return "Canvas";
        } else if (component.getComponent().getName().equals("workspace_window")) {
            return "Workspace";
        } else {
              return component.getComponent().getName();
        }
    }
}

